package edu.hawaii.duedates.library;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;


/**
 * This will test coverage of the Collection and ObjectFactory classes.
 * 
 * @author Robin E. Raqueno and Ronn Reeves
 *
 */
public class TestObjectFactory {
  
  /**
   * Test all methods in the ObjectFactory class and Collection class.
   */
  @Test
  public void testCreateObject() {
    ObjectFactory objFactory = new ObjectFactory();
    
    String failed = "Test Failed";
    assertTrue(failed, LibraryType.class.isInstance(objFactory.createLibraryType()));
    assertTrue(failed, Collection.class.isInstance(objFactory.createCollection()));
    assertEquals(failed, objFactory.createCollection().getLibraries(), null);
    
    objFactory.createCollection().setLibraries(null);
    assertNull(failed, objFactory.createCollection().getLibraries());
    assertEquals(failed, objFactory.createCollectionLibraries().getLibrary().toString(), "[]");
  }
}
